<?php $this->headTitle(__('Customer Details')); ?>
<div id="maincontent">
    <div class="pg-header">Customer Info</div>
    <?php if($this->customer):  ?>
        <table width="100%">
            <thead>
                <th  style="width:100px;"><?php echo __('Title'); ?></th>
                <th colspan="2"><?php echo __('Information'); ?></th>
            </thead>
            <tbody>
                <tr><td><?php echo __('First Name') ?></td><td><?php echo $this->customer['first_name'] ?></td>
                    <td rowspan="4" width="80">
                    <?php $imgPath =  (isset($this->customer['image']))? "/".$this->customerImagePath. "/" .$this->customer['image']:'/images/noimage.png'; ?>
                        <img width="120" height="120" src="<?php echo $imgPath  ?>" alt="Image" />
                    </td>
                </tr>
                <tr><td><?php echo __('Last Name') ?></td><td><?php echo $this->customer['last_name'] ?></td></tr>
                <tr><td><?php echo __('Bank') ?></td><td><a href="#"><?php echo $this->customer['Bank']['name'] ?></a></td></tr>
                <tr><td><?php echo __('Contact number') ?></td><td><?php echo $this->customer['contact_no'] ?></td></tr>
                <tr><td><?php echo __('Permanent Address') ?></td><td colspan="2"><?php echo $this->customer['permanent_address'] ?></td></tr>
                <tr><td><?php echo __('Current Address') ?></td><td colspan="2"><a href="#"><?php echo $this->customer['current_address']; ?></a></td></tr>
                <tr><td><?php echo __('Citizenship') ?></td><td colspan="2"><?php echo $this->customer['citizenship_no'] ?></td></tr>
                <tr><td><?php echo __('District of citizenship') ?></td><td colspan="2"><?php echo $this->customer['District']['name'] ?></td></tr>
                <tr><td><?php echo __('Passport No') ?></td><td colspan="2"><?php echo ($this->customer['passport_no'])?$this->customer['passport_no']:"--"; ?></td></tr>
           </tbody>
        </table>
    <?php else: ?>
        <div><?php echo __('Customer Not found'); ?></div>
    <?php endif; ?>
        <div class="pg-header">Loan Info <a class="title-right span-r" id="add" add:url="<?php echo $this->baseUrl('service/loan/add/cid/'.Custom_General::encode($this->customer['id']))?>">Create Loan</a></div>
    <div id="loaninfo">
        <?php echo $this->action('index', 'loan', 'service', array('cid'=> $this->customer['id'])); ?>
    </div>
</div>

<script type="text/javascript">
// jQuery UI Dialog
$(document).ready(function(){
    $('#add').click(function(){
            var url = $(this).attr('add:url');
            $('<div id="ss"></div>').dialog({
                width:550,
                modal:true,
                resizable:false,
                position:'center',
                title:'<?php echo __('Loan Add') ?>',
                close:function(){$('#ss').remove();},
                open:function(){
                    $(this).html('<?php echo __('Loading...'); ?>');
                    $(this).load(url,'',function(){});
                }

            });
        });
  });

</script>